<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8">
    <title>全视图BOM展示</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta content="no-cache, no-store, must-revalidate" http-equiv="Cache-Control"/>
    <meta content="no-cache" http-equiv="Pragma"/>
    <meta content="0" http-equiv="Expires"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=8">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <link rel="stylesheet" href="../styles/base.css"/>
    <link rel="stylesheet" href="../styles/common.css"/>
    <link rel="stylesheet" href="../styles/font/iconfont.css"/>
    <link rel="stylesheet" href="../jqueryNicepage/css/layui.css"  media="all">
    <style>
        body{
            background:#ddecf5;
            height:100%;
            width:100%;
            min-width: 1200px;
        }
        .seachHeader span{
            margin-top: 5px;
            float: left;
            display: inline-block;
            height:30px;
            line-height: 30px;
            font-size: 16px;

        }
        .seachHeader span:first-child{
            margin-left: 20px;
        }
        .seachHeader .inputBox{
            float:left;
            width:200px;
            height:30px;
            line-height: 30px;
            font-size: 14px;
            padding-left: 10px;
            position: relative;
        }
        .seachHeader .inputBox input{
            width:190px;
            height:30px;
            line-height: 30px;
            position: absolute;
            padding-left: 10px;
            left:0;
        }
        .searchSureBtn{
            margin-left: 30px;
            float:right;
            background-color: #eee;
            font-family: 'Open Sans', sans-serif;
            font-size: 14px;
            text-decoration: none;
            font-weight: 600;
            color: #333;
            position: relative;
            padding: 1px 15px;
            margin-right: 15px;
            margin-top:2px;
            border-top-right-radius: 10px;
            border-bottom-right-radius: 10px;
            border-top-left-radius: 10px;
            border-bottom-left-radius: 10px;
            background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0, rgb(242,242,242)), color-stop(1, rgb(242,242,242)) );
            cursor: pointer;
            overflow: hidden;
        }
        .searchSureBtn:hover{
            color:#fff;
            background:#40E0D0;
        }
        .searchContainer{
            position:relative;
            width:96%;
            margin-left: 2%;
            margin-top:5px;
            min-width: 1200px;
        }
        /*#pageBar2{
            display: none;
        }*/
        .seachHeader .selectedItem{
            display: none;
        }
        .selectedItemFrom .layui-form{
            width:260px;
            font-size: 14px;
        }
        .layui-table tr td{
            text-align: center;
        }
        .layui-table tr td a{
            float:left;
           /* width:45px;*/
            text-align: center;
            padding:0 5px;
            color:#0000FF;
            cursor: pointer;
            text-decoration:underline;
        }
        .layui-table tr td .noCursor{
            cursor:default;
        }
        .layui-table tr td span{
            float:left;
            width:5px;
            text-align: center;
        }
        .layui-table tr .td3,.layui-table tr .td5{
            text-align: left;
        }
        .layui-table tr .td3 a{
            color:#0000FF;
            cursor: pointer;
            text-decoration:underline;
        }
     /*   .layui-table tr .td2 a,*/.layui-table tr td a{
            float:left;
            width:auto;
            white-space:nowrap;
            text-align: center;
                                   }
        .layui-table tr .td1 span,.layui-table tr .td0 span,.layui-table tr .td4 span{
           display: none;
        }
        .titleName{
            float:left;
        }
        .layui-form{
            float:left;
            margin-left: -100px;
        }
        .formContent{
            height:auto;
            /*overflow-y: scroll;*/
        }
        .formContent center{
            margin-top:-10px;
        }
        .formContent center #pageBar2{
            position:absolute;
            bottom:10px;
            width:100%;
            text-align: center;
            display:none;
        }
        .formContent .layui-table .td0{
            text-align: left;
        }

        .formContent .layui-table .td0 a,.formContent .layui-table .td1 a,.formContent .layui-table .td4 a,.formContent .layui-table .td3 a{
            width:100%;
            text-align: center;
        }
        .formContent .layui-table .td1 a{
            text-align: left;
        }
        .formContent .layui-table .td1{
            text-align: left;
        }
        #table2 table tbody tr:first-child td{
            box-sizing: border-box;
        }
        .formContent .layui-table tr td:first-child, .formContent .layui-table tr th:first-child{
            max-width:999px ;
            width:30px;
        }
    </style>
</head>
<body>
<div id="loading">
    <img src='../styles/img/loading.gif' />
</div>
<div class="searchContainer">
    <div class="seachHeader">
        <span>物料编号：</span>
        <span class="centerInput"></span>
        <span><div class="searchSureBtn searchClickBtn">搜索物料</div></span>
        <span><div class="searchSureBtn searchClickBtn1">搜索图文档</div></span>
       <!-- <span class="selectedItemFrom">
            <span class="titleName">请选择:</span>
            <form class="layui-form layform3" action=""> <div class="layui-form-item proSelect"> <div class="layui-input-block editWidth"> <select class="select1" name="" lay-verify="" lay-filter="select1"> <option value=""></option> &nbsp;</select> </div> </div></form>
        </span>-->
        <!--20190802将图纸下载按钮隐藏-->
        <!--<span class="selectedItem"><div class="searchSureBtn download">图纸下载</div></span>-->
        <span class="selectedItem"><div class="searchSureBtn toExcell">导出BOM</div></span>
    </div>
    <div class="formContent">
    </div>
</div>
</body>
<script type="text/javascript" src="../js/jquery-1.11.3.min.js"></script>
<script src="../js/common/publicClass.js"></script>
<script src="../js/common/myAjax.js"></script>
<script src="../js/common/utils.js"></script>
<!--<script type="text/javascript" src="../js/layui/layui.js"></script>-->
<script src="../layer/layer.js" charset="utf-8"></script>
<script language="Javascript" src="../jqueryNicepage/js/layui.js"></script>
<script>
    maximizeWindow();//设置屏幕大小
   /* var heightform=$(".searchContainer").height()-$(".seachHeader").height()-20;
    $(".formContent").css("height",heightform*0.85);*/
    $(".centerInput").append(setInput("请输入物料编号","",50,"text"));
    var pubInputVal="";//保存点击按钮请求表格的val值
    var tableText="";//记录渲染的是哪个表格
    var height=document.body.clientHeight;
    var width =document.body.clientWidth;
    $("#loading img").css({
        "margin-left":width/2-25+"px",
        "margin-top":height/2-25+"px"
    })
    //var dataTypeArr=[{researchName:"物料",showName:"物料"},{researchName:"图文档",showName:"图文档"}]
    //renderForm(dataTypeArr,"1","obj","",formCallback);
    $(".publicInputText").focus(function(){
        $("label").css({
            "display":"none"
        })
    })
    $(".publicInputText").blur(function(){
        if($(this).val()!=""){

        }else{
            $("label").css({
                "display":"inline-block"
            })
        }
    })
    function searchFn(){
        if($(".publicInputText").val().replace(/\s+/g,"")!=""){
            tableText="WL";
            pubInputVal=$(".publicInputText").val();
            var url = "/AllViewBomDisplayController/queryAllViewBom",
                    data="partNumber="+encodeURIComponent($(".publicInputText").val().replace(/\s+/g,""))+"&view=";
            $("#loading").css({
                display:"block"
            });
            MaterialReverseAjax(url,data,suCallback);

        }else{
            layerFn("物料编号不能为空，请输入物料编号！");
        }
    }

    $(".searchClickBtn1").click(function(){
        formCallback();
    })
    $(".searchClickBtn").click(function(){
        searchFn();
    })
    $('.centerInput input').bind('keyup', function(event) {
        if (event.keyCode == "13") {
            //回车执行查询
            searchFn();
        }
    });
    function formCallback(str){
        pubInputVal=$(".publicInputText").val();
        tableText="TD";
            var url="/AllViewBomDisplayController/queryAllDoc",
                    data="partNumber="+encodeURIComponent($(".publicInputText").val().replace(/\s+/g,""));
            //console.log($(".publicInputText").val().replace(/\s+/g,""));
            if($(".publicInputText").val()!=undefined&&$(".publicInputText").val().replace(/\s+/g,"")!=""){
                $("#loading").css({
                    display:"block"
                });
                MaterialReverseAjax(url,data,function(str){
                    if(str.docDate!=undefined&&str.docDate.length>0){
                        $(".seachHeader .selectedItem").css({
                            "display":"block"
                        })
                        $("#loading").css({
                            display:"none"
                        });
                        var dataListObjArr=[];
                        for(var i=0;i<str.docDate.length;i++){
                            var dataListObj={};
                            //dataListObj.partNumber=str.docDate[i].partNumber;//物料编号
                            dataListObj.partNumber=str.docDate[i].partNumber+"|"+str.docDate[i].partNumberURL+"{}";
                            dataListObj.partDescription=str.docDate[i].partDescription;//描述
                            dataListObj.partVersion=str.docDate[i].partVersion;//最新版本号
                            //dataListObj.partView=str.docDate[i].compareUppartView+"|"+"flage"+"{}";//产地视图
                            dataListObj.docNumber=str.docDate[i].docNumber+"|"+str.docDate[i].docNumberURL+"{}";
                            dataListObj.docURL="预览"+"|"+str.docDate[i].docURL+"{}";//预览
                            dataListObj.docName=str.docDate[i].docName//关联图纸名称
                            dataListObj.docVersion=str.docDate[i].docVersion//图纸最新版本
                            dataListObjArr.push(dataListObj);
                        }
                        var heightform=$(".searchContainer").height()-$(".seachHeader").height()-20;
                        $(".formContent").css({
                            "max-height":heightform*0.85,
                            "overflow-y":"scroll"
                        });
                        window.selectedAll=true;
                        window.historyList1=dataListObjArr.sort(compareUp(dataListObjArr,"partNumber"));
                        window.headers1=["<input id='checkAllData' title='全选' type='checkbox'>","序号","物料编号<i title='降序' class='iconfont up'>&#xe64d;</i>","物料描述","最新版本号","图纸编号","预览","关联图纸名称","图纸最新版本"]; //table的列名
                        window.widths1=["100","100","100","500","200","200","200","300","200"]
                        $(".formContent").empty().load('./newTable.html',"",function(){
                            setTimeout(function(){
                                var heightform=$(".searchContainer").height()-$(".seachHeader").height()-20;

                                if($(".formContent")[0].offsetHeight>(heightform*0.85)){
                                    $("#pageBar2").css("top",heightform*0.85+$(".seachHeader").height()+30)
                                }else{
                                    $("#pageBar2").css("top",$(".formContent")[0].offsetHeight+$(".seachHeader").height()+50);
                                }
                                $("#pageBar2").css("display","block")
                                clearTimeout();
                            },200)
                        });
                        $(".formContent .layui-table tr .td0 a").css({
                            //"width":"100%",
                            "text-align": "center"
                        })
                        $(".formContent #pageBar2").css({
                            "display":"block"
                        })
                    }else{
                        var mesg=str.tip!=undefined&&str.tip!=""?str.tip:"您查询的数据不存在！"
                        layerFn(mesg);
                    }
                })
                $(".formContent").on("click","thead tr th:first-child +th+th",function(){

                    $("#pageBar").css({
                        display:"none"
                    });
                    if($(this).find("i")==undefined){
                        return;
                    }
                    $("#loading").css({
                        display:"block"
                    });
                    var className=$(this).find("i").attr("class").split(" ")[1];
                    if(className=="up"){
                        //["序号","料号","文档名称", "型号", "版号", "存储位置","图纸类型", "生效日期", "拟制人", "研发地", "生产地", "临时图纸", "状态"] //table的列名
                        var icon=["<input id='checkAllData' title='全选' type='checkbox'>","序号","物料编号<i title='升序' class='iconfont down'>&#xe604;</i>","物料描述","最新版本号","图纸编号","预览","关联图纸名称","图纸最新版本"]
                        window.historyList1=window.historyList1.sort(compareUp(window.historyList1,"partNumber"));
                    }else if(className=="down"){
                      //  var icon=["序号","料号<i title='升序' class='iconfont up'>&#xe64d;</i>","文档名称", "型号", "版号", "存储位置","图纸类型", "生效日期", "拟制人", "研发地", "生产地", "临时图纸", "状态"] //table的列名
                        //  var icon=["全选","序号","受影响对象料号"+"<i title='从大到小' class='iconfont up'>&#xe64d;</i>","视图"+"<i title='从大到小' class='iconfont up'>&#xe64d;</i>","受影响对象状态"];
                        var icon=["<input id='checkAllData' title='全选' type='checkbox'>","序号","物料编号<i title='降序' class='iconfont up'>&#xe64d;</i>","物料描述","最新版本号","图纸编号","预览","关联图纸名称","图纸最新版本"]
                        window.historyList1=window.historyList1.sort(compareDown(window.historyList1,"partNumber"));
                    }


                    window.headers1=icon;
                    $(" .formContent").empty();
                    //$(".searchContainer").append('<div class="formContent"></div>')
                    $(".formContent").empty().load('./newTable.html',"",function(){
                        $("#loading").css({
                            display:"none"
                        });
                        setTimeout(function(){
                            var heightform=$(".searchContainer").height()-$(".seachHeader").height()-20;

                            if($(".formContent")[0].offsetHeight>(heightform*0.85)){
                                $("#pageBar2").css("top",heightform*0.85+$(".seachHeader").height()+30)
                            }else{
                                $("#pageBar2").css("top",$(".formContent")[0].offsetHeight+$(".seachHeader").height()+50);
                            }
                            $("#pageBar2").css("display","block")
                            clearTimeout();
                        },200)
                    });
                })
            }else{
                layerFn("物料编号不能为空，请输入物料编号！")
            }
    }

    function suCallback(str){
        $("#loading").css({
            display:"none"
        });
        if(str.partDate!=undefined&&str.partDate.length>0){
            var dataListObjArr=[];
            for(var i=0;i<str.partDate.length;i++){
                var dataListObj={};
                dataListObj.level=str.partDate[i].level;
                dataListObj.partNumber=str.partDate[i].partNumber+"|"+str.partDate[i].partNumberURL+"{}";
                dataListObj.subPart="";
                for(var m=0;m<str.partDate[i].subPart.length;m++){
                    if(m!=(str.partDate[i].subPart.length/*-1*/)){
                        dataListObj.subPart+=str.partDate[i].subPart[m].number+"|"+str.partDate[i].subPart[m].numberURL+"{}";
                    }else{
                        dataListObj.subPart+=str.partDate[i].subPart[m].number+"|"+str.partDate[i].subPart[m].numberURL;
                    }
                }
                dataListObj.partDescription=str.partDate[i].partDescription;
                dataListObj.partVersion=str.partDate[i].partVersion;
                str.partDate[i].viewStr=str.partDate[i].viewStr.sort(compareUp(str.partDate[i].viewStr,"view"));
                dataListObj.viewStr="";
                for(var m=0;m<str.partDate[i].viewStr.length;m++){
                    if(m!=(str.partDate[i].viewStr.length/*-1*/)){
                        dataListObj.viewStr+=str.partDate[i].viewStr[m].view+"|"+str.partDate[i].viewStr[m].number+"{}";
                    }else{
                        dataListObj.viewStr+=str.partDate[i].viewStr[m].view+"|"+str.partDate[i].viewStr[m].number;
                    }

                }
               // dataListObj.viewStr=dataListObj.viewStr.compareUp(dataListObj.viewStr,"")
                //dataListObj.viewStr=str.partDate[i].viewStr;
                dataListObj.partState=str.partDate[i].partState;
                dataListObjArr.push(dataListObj);
            }
            $(".seachHeader .selectedItem").css({
                "display":"block"
            });
            var heightform=$(".searchContainer").height()-$(".seachHeader").height()-20;
            $(".formContent").css({
                "max-height":heightform*0.85,
                "overflow-y":"scroll"
            });
            window.selectedAll=false;
            window.historyList1=dataListObjArr;/*.sort(compareUp(dataListObjArr,"level"));*/
            window.headers1=["序号","层级","物料编号","替代料编号","物料描述","最新版本号","产地视图","状态"] //table的列名
            window.widths1=["100","100","200","400","500","200","300","200"]
            $(".formContent").empty().load('./newTable.html',"",function(){
                setTimeout(function(){
                    var heightform=$(".searchContainer").height()-$(".seachHeader").height()-20;

                    if($(".formContent")[0].offsetHeight>(heightform*0.85)){
                        $("#pageBar2").css("top",heightform*0.85+$(".seachHeader").height()+30)
                    }else{
                        $("#pageBar2").css("top",$(".formContent")[0].offsetHeight+$(".seachHeader").height()+50);
                    }
                    $("#pageBar2").css("display","block");
                    clearTimeout();
                    var marginlelftLen=[];
                    for(var i=0;i< $(".formContent table tbody tr").length;i++){
                        marginlelftLen.push($(".formContent table tbody tr").eq(i).find(".td0").text()*1)
                    }
                    for(var m=0;m<marginlelftLen.length;m++){
                        $(".formContent table tbody tr").eq(m).find(".td1  a").css({
                            "padding-left":marginlelftLen[m]*10
                        })
                    }
                },200)
            });
            $(".formContent .layui-table td").css({
                "text-align": "left"
            })
            $(".formContent #pageBar2").css({
                "display":"none"
            })
        }else{
            layerFn("您查询的数据不存在！");
        }
    }
    $(".download").click(function(){//下载文档
        if(pubInputVal!=undefined&&pubInputVal!=""){
            $("#loading").css({
                display:"block"
            });
            var datalistD=[];
            if(arrFlage.length>0){
                for(var m=0;m<arrFlage.length;m++){
                    var newdata=arrFlage[m].split("&;")
                    var obj={};
                    obj.partNumberShow=newdata[0];
                    obj.docNumber=newdata[1];
                    obj.partNumber=newdata[2];
                    datalistD.push(obj);
                }

            }else{
                layerFn("请选择勾选需要下载的数据行");
                return;
            }
            var url="/AllViewBomDisplayController/queryAllDocURL",
                data={
                    list:datalistD
                }
                 //   data="partNumber="+encodeURIComponent(pubInputVal);
            ajaxNewFn(url,data,function(str){
                $("#loading").css({
                    display:"none"
                });
                var lack=str.lack!=""&&str.lack!=undefined?str.lack:"";
                var noDownload=str.noDownload!=""&&str.noDownload!=undefined?str.noDownload:"";
                if(lack!=""||noDownload!=""){
                    var excelUrl=str.zipURL!=undefined&&str.zipURL!=""?str.zipURL:"";
                    var mesg=lack+noDownload+"是否继续下载？";

                    if(excelUrl!=""){
                        deleteTips(mesg,function(){
                            window.location.href=excelUrl
                            // window.open(excelUrl)
                        },"")
                    }else{
                         mesg=lack+noDownload;
                        layerFn(mesg);
                    }

                }else{
                    var excelUrl=str.zipURL!=undefined&&str.zipURL!=""?str.zipURL:"";
                    if(excelUrl!=""){
                        window.location.href=excelUrl
                    }else{
                        var mesg=str.tip!=undefined&&str.tip!=""?str.tip:"系统异常，稍后重试！"
                        layerFn(mesg);
                    }
                    //window.location.href=excelUrl
                    // window.open(excelUrl)
                }

            })
        }
    })
    $(".toExcell").click(function(){//导出EXcell
        if(pubInputVal!=undefined&&pubInputVal!=""){
            $("#loading").css({
                display:"block"
            });
            var url="/AllViewBomDisplayController/ queryAllBOMExcelURL",
                    data="partNumber="+encodeURIComponent(pubInputVal);
            MaterialReverseAjax(url,data,function(str){
                $("#loading").css({
                    display:"none"
                });
                var excelUrl=str.excelURL!=undefined&&str.excelURL!=""?str.excelURL:"";
                if(excelUrl!=""){
                   // window.open(excelUrl)
                    window.location.href=excelUrl
                }else{
                    var mesg=str.tip!=undefined&&str.tip!=""?str.tip:"系统异常，稍后重试！"
                    layerFn(mesg);
                }
            })
        }

    })
    $(document).unbind().on("click",".layui-table tr .td5 a",function(){
        var url="/AllViewBomDisplayController/queryChildren";
        var view=$(this).text()!=undefined&&$(this).text()!=""?$(this).text():"";
        var number=$(this).attr("data-num")!=undefined&&$(this).attr("data-num")!=""?$(this).attr("data-num"):"";
        if(view!=""&&number!=""&&number!="flage"){

            window.open("allBomTow.html?partNumber="+number+"&view="+view)
        }
    })
    $("body").unbind().on("click",".layui-table tr td a",function(){
        if($(this).parent().attr("class")!="td5"){
            var url=$(this).attr("data-num")!=undefined&&$(this).attr("data-num")!=""?$(this).attr("data-num"):"";

            if(url!=""&&url!="flage"&&$(this).text()=="预览"){
                var docNumber="docNumber="+$(this).parents("tr").find(".td3 a").text();
                MaterialReverseAjax("/AllViewBomDisplayController/queryPermissions",docNumber,function(str){
                    if(str.message=="yes"){
                        localStorage.setItem("urlParam",url)
                        window.open('bank.html');
                    }else{
                        var tips=str.hint!=undefined&&str.hint!=""?str.hint:"您没有权限查看此文档"
                        layerFn(tips);
                    }
                })

            }else if(url!=""&&url!="flage"){
                window.open(url,"_blank");
             //   window.open(url)
            }


        }

    })
    $(".formContent").scroll(function() {
        var scrolltop=$(this).scrollTop();
        if(scrolltop>0){
            $("#table2 table thead").css({
                "position":"absolute",
                "background":"#f2f2f2",
                "opacity":"1",
                "z-index": 999,
                "top":$(".seachHeader")[0].offsetHeight
            })
        }else{
            $("#table2 table thead").css({
                "position":""

            })
        }
        $("#table2 table thead tr").css({
            "width":$("#table2 table").width()

        })
        //var len=window.historyList1!=undefined?window.historyList1.length:
        for (var i = 0; i <  window.historyList1.length; i++) {
            var width = $("#table2 table tbody tr:first-child td").eq(i).width() ;

            if(IEVersion()>(8)){
                $("#table2 .layui-table thead tr:first-child th").eq(i).css({
                    "width": width
                })
            }else if(IEVersion()==(8)){
                $("#table2 .layui-table thead tr:first-child th").eq(i).css({
                    "width": width+1
                })
            }else{
                $("#table2 .layui-table thead tr:first-child th").eq(i).css({
                    "width": width+1
                })
            }


        }
    })
    $(window).resize(function () { //当浏览器大小变化时
        //console.log($("#table2 table").width())
        $("#table2 table thead tr").css({
            "width":$("#table2 table").width()

        })
        var heightform=$(".searchContainer").height()-$(".seachHeader").height()-20;
        $(".formContent").css({
            "max-height":heightform*0.85,
            "overflow-y":"scroll"
        });
               // var heightform=$(".searchContainer").height()-$(".seachHeader").height()-20;

                if($(".formContent")[0].offsetHeight>(heightform*0.85)){
                    $("#pageBar2").css("top",heightform*0.85+$(".seachHeader").height()+30)
                }else{
                    $("#pageBar2").css("top",$(".formContent")[0].offsetHeight+$(".seachHeader").height()+50);
                }
        for (var i = 0; i <  window.historyList1.length; i++) {
            var width = $("#table2 table tbody tr:first-child td").eq(i).width() ;

            if(IEVersion()>(8)){
                $("#table2 .layui-table thead tr:first-child th").eq(i).css({
                    "width": width
                })
            }else if(IEVersion()==(8)){
                $("#table2 .layui-table thead tr:first-child th").eq(i).css({
                    "width": width+1
                })
            }else{
                $("#table2 .layui-table thead tr:first-child th").eq(i).css({
                    "width": width+1
                })
            }


        }
    });
var arrFlage=[];//用于存放多选框选中的值；
     //选择框点击事件
     $('html').unbind("click").on('click','tbody tr td input',function () {
         var father=$(this).parents("tr");
         var tdText=$(father).find(".td0 a").text();
         var tdEff=$(father).find(".td3 a").text();
         var versionText=encodeURIComponent(pubInputVal);
         var texts=tdText+"&;"+tdEff+"&;"+versionText;
         var index=getIndexof(arrFlage,texts);
         if(index<0){
             arrFlage.push(texts);
         }else{
             arrFlage.splice(index, 1);
             $("#checkAllData").removeProp("checked","checked")
         }
         var flage=0;
         for(var i=0;i<$(".checkboxS").length;i++){
             if($(".checkboxS").eq(i).prop('checked')){
                 //flage=true;
             }else{

                 flage+=1;
             }
         }
         if(flage==0){
             $("#checkAllData").prop("checked","checked")
         }
         $(".layui-laypage-count i").text(arrFlage.length)
     });
     $(".formContent").on("click","#checkAllData",function(){
         if($('#checkAllData').prop('checked')){//第一次点击
             $("tbody tr input").prop("checked","checked");
             for(var i=0;i<$("tbody tr ").length;i++){
                 var tdText=$("tbody tr ").eq(i).find(".td0 a").text();
                 var tdEff=$("tbody tr").eq(i).find(".td3 a").text();
                 var versionText=encodeURIComponent(pubInputVal);
                 var texts=tdText+"&;"+tdEff+"&;"+versionText;
                 var index=getIndexof(arrFlage,texts);
                 if(index==(-1)){
                     arrFlage.push(texts);
     }
     }
     }else{//第二次点击
         $("tbody tr input").removeProp("checked");
         for(var i=0;i<$("tbody tr ").length;i++){
             var tdText=$("tbody tr ").eq(i).find(".td0 a").text();
             var tdEff=$("tbody tr").eq(i).find(".td3 a").text();
             var versionText=encodeURIComponent(pubInputVal);
             var texts=tdText+"&;"+tdEff+"&;"+versionText;
             var index=getIndexof(arrFlage,texts);
             if(index>(-1)){
                 arrFlage.splice(index, 1);
             }
         }
     }
         $(".layui-laypage-count i").text(arrFlage.length)
     });
     window.onclick=function(){
    //$(".searchContainer").on("click","#pageBar2",function(){
        var flage=0;
        for(var i=0;i<$("tbody tr ").length;i++){
            var tdText=$("tbody tr ").eq(i).find(".td0 a").text();
            var tdEff=$("tbody tr").eq(i).find(".td3 a").text();
            var versionText=encodeURIComponent(pubInputVal);
            var texts=tdText+"&;"+tdEff+"&;"+versionText;
            if(getIndexof(arrFlage,texts)>(-1)){
                $(".checkboxS").eq(i).prop("checked","checked");
            }else{

            }
        }
        for(var m=0;m<$(".checkboxS").length;m++){
            if($(".checkboxS").eq(m).prop('checked')){
                flage+=1;
            }else{

            }
        }
        if(flage==$(".checkboxS").length){
            $("#checkAllData").prop("checked","checked")
        }
         $(".layui-laypage-count i").text(arrFlage.length)
    }//)

</script>
</html>